/**   
 * 项目名：五位一体化工安全信息平台
 * 日期：    2019-12-08 18:31:39  
 * Copyright (c) 2015- joysuch-版权所有     
 */

package com.joysuch.wwyt.core.entity;

import static javax.persistence.GenerationType.IDENTITY;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Entity
@Table(name = "wwyt_base_user_menu_function")
@SQLDelete(sql = "update wwyt_base_user_menu_function set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_base_user_menu_function set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")

public class BaseUserMenuFunction implements java.io.Serializable {

    // columns START
    // ID
    private Long id;
    // 角色ID
    private Long userId;
    // 租户
    private Long tenentId;
    // 菜单ID
    private Long menuId;
    // 数据权限
    private String dataRule;
    // 数据权限连接条件
    private String dataRuleConnector;
    // 创建人
    private Long createBy;
    // 创建时间
    private java.util.Date createTime;
    // 更新人
    private Long updateBy;
    // 更新时间
    private java.util.Date updateTime;
    // 删除标记
    private String deleteFlag;
    // 组织机构代码
    private String orgCode;
    // columns END

    public void setId(Long value) {
        this.id = value;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "Id", unique = true, nullable = false)
    public Long getId() {
        return this.id;
    }

    @Column(name = "USER_ID", unique = true)
    public Long getUserId() {
        return this.userId;
    }

    public void setUserId(Long value) {
        this.userId = value;
    }

    @Column(name = "TENENT_ID")
    public Long getTenentId() {
        return this.tenentId;
    }

    public void setTenentId(Long value) {
        this.tenentId = value;
    }

    @Column(name = "MENU_ID")
    public Long getMenuId() {
        return this.menuId;
    }

    public void setMenuId(Long value) {
        this.menuId = value;
    }

    @Column(name = "DATA_RULE", length = 1000)
    public String getDataRule() {
        return this.dataRule;
    }

    public void setDataRule(String value) {
        this.dataRule = value;
    }

    @Column(name = "DATA_RULE_CONNECTOR", length = 10)
    public String getDataRuleConnector() {
        return this.dataRuleConnector;
    }

    public void setDataRuleConnector(String value) {
        this.dataRuleConnector = value;
    }

    @org.springframework.data.annotation.CreatedBy
    @Column(name = "CREATE_BY")
    public Long getCreateBy() {
        return this.createBy;
    }

    public void setCreateBy(Long value) {
        this.createBy = value;
    }

    @org.springframework.data.annotation.CreatedDate
    @Column(name = "CREATE_TIME")
    public java.util.Date getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(java.util.Date value) {
        this.createTime = value;
    }

    @org.springframework.data.annotation.LastModifiedBy
    @Column(name = "UPDATE_BY")
    public Long getUpdateBy() {
        return this.updateBy;
    }

    public void setUpdateBy(Long value) {
        this.updateBy = value;
    }

    @org.springframework.data.annotation.LastModifiedDate
    @Column(name = "UPDATE_TIME")
    public java.util.Date getUpdateTime() {
        return this.updateTime;
    }

    public void setUpdateTime(java.util.Date value) {
        this.updateTime = value;
    }

    @Column(name = "DELETE_FLAG", length = 2)
    public String getDeleteFlag() {
        return this.deleteFlag;
    }

    public void setDeleteFlag(String value) {
        this.deleteFlag = value;
    }

    @Column(name = "ORG_CODE", length = 100)
    public String getOrgCode() {
        return this.orgCode;
    }

    public void setOrgCode(String value) {
        this.orgCode = value;
    }

    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId())
                .append("roleId", getUserId()).append("tenentId", getTenentId()).append("menuId", getMenuId())
                .append("dataRule", getDataRule()).append("dataRuleConnector", getDataRuleConnector())
                .append("createBy", getCreateBy()).append("createTime", getCreateTime())
                .append("updateBy", getUpdateBy()).append("updateTime", getUpdateTime())
                .append("deleteFlag", getDeleteFlag()).append("orgCode", getOrgCode()).toString();
    }

    public int hashCode() {
        return new HashCodeBuilder().append(getId()).toHashCode();
    }

    public boolean equals(Object obj) {
        if (obj instanceof BaseUserMenuFunction == false)
            return false;
        if (this == obj)
            return true;
        BaseUserMenuFunction other = (BaseUserMenuFunction) obj;
        return new EqualsBuilder().append(getId(), other.getId()).isEquals();
    }
}
